package behavioral.iterator;

public class IteratorPattern {
    public static void main(String[] args) {
        BrowserHistory history = new BrowserHistory();
        history.push("https://www.google.com");
        history.push("https://www.baidu.com");
        history.push("https://www.qq.com");

        Iterator<String> iterator = history.createIterator();

        while (iterator.hasNext()) {
            System.out.println(iterator.current());
            iterator.next();
        }
    }
}
